<?php


namespace App\Kuafu\Sms\Controller\H5;


use App\Kuafu\Base\Controller\BaseController;
use App\Kuafu\Sms\Service\SmsService;
use App\Kuafu\Sys\Exceptions\SysException;
use App\Kuafu\User\Enum\UserCodeEnum;
use App\Kuafu\User\Exceptions\UserException;
use App\Kuafu\User\Model\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class SmsController extends BaseController
{

    /**
     * 发送短信验证码
     * @param Request $request
     * @return JsonResponse
     * @throws UserException
     */
    public function sendSms(Request $request): JsonResponse
    {
        $mobile = $request->mobile;
        $type   = $request->type ?: 0;

        SmsService::sendSms($mobile, $type);

        return $this->success(['msg' => 'ok']);
    }
}
